<?php

namespace Itbbn\ThinkphpModelCreater\lib;

class Util
{
    public static function writeln($str)
    {
        echo $str . PHP_EOL;
    }

    public static function getValueFromArray($key, $array, $default = "")
    {
        if (array_key_exists($key, $array) && $array[$key] !== "") {
            return $array[$key];
        }
        return $default;
    }

    /**
     * 获取时间
     * @param $format
     * @param $time
     * @return string
     */
    public static function getTime($format="Y-m-d H:i:s",$time=null): string
    {
        if(!$time){
            $time=time();
        }
        return date($format,$time);
    }

}